package org.bite.lesson01;

public class Demo04_Runnable {
    public static void main(String[] args) {
        //创建Runnable示例
        MyRunnable02 myRunnable02 = new MyRunnable02();
        MyRunnable03 myRunnable03 = new MyRunnable03();
        //创建线程
        Thread thread1 = new Thread(myRunnable02);
        Thread thread2 = new Thread(myRunnable02);
        Thread thread3 = new Thread(myRunnable03);
        //启动线程
        thread1.start();
        thread2.start();
        thread3.start();
    }
}
class MyRunnable02 implements Runnable{
    @Override
    public void run(){
        while(true){
            try{
                Thread.sleep(1000);
            }catch(InterruptedException e){
                e.printStackTrace();
            }
            System.out.println("生产手机，金币+2000❤");
        }
    }
}
class MyRunnable03 implements Runnable{
    @Override
    public void run(){
        while(true){
            try{
                Thread.sleep(1000);
            }catch(InterruptedException e){
                e.printStackTrace();
            }
            System.out.println("生产电脑，金币+4000😊");
        }
    }
}
